/*
** objects.c for Object in /home/vriely/Dropbox/work/Unix/Zappy_rendu/serv-src
**
** Made by Samuel Vrielynck
** Login   <vriely_s@epitech.net>
**
** Started on  Mon Jun 11 17:43:42 2012 Samuel Vrielynck
** Last update Fri Jul 20 09:37:23 2012 guillaume renard
*/

#include	<string.h>

#include	"server.h"

char		*gere_ressource(t_gamer *gamer, t_game *game, char type,
    e_ressource ressource)
{
  if (type == 1)
  {
    if (gamer->inventory[ressource] > 0)
    {
      game->obj[gamer->coord.y][gamer->coord.x].inv[ressource]++;
      gamer->inventory[ressource]--;
      return (strdup("ok\n"));
    }
  }
  else
  {
    if (game->obj[gamer->coord.y][gamer->coord.x].inv[ressource] > 0)
    {
      game->obj[gamer->coord.y][gamer->coord.x].inv[ressource]--;
      gamer->inventory[ressource]++;
      return (strdup("ok\n"));
    }
  }
  return (strdup("ko\n"));
}
